Skip to content

feat: introduce integration with Gradient AI - #6179

Closed
mhlgio wants to merge 13 commits into
deepset-ai:mainfrom
Preemo-Inc:main
Closed

feat: introduce integration with Gradient AI#6179
mhlgio wants to merge 13 commits into
deepset-ai:mainfrom
Preemo-Inc:main

Conversation

@mhlgio

@mhlgio mhlgio commented Oct 26, 2023

Copy link
Copy Markdown

Related Issues

Doesn't have have a related issue.

Proposed Changes:

Gradient AI is a self-managed cloud service for Large Language Models, offering fine-tuning and inference of open-source models and embeddings generation. This PR integrates haystack with Gradient for LLMs and embeddings by adding relevant generators and embedders.

How did you test it?

  • unit testing,
  • e2e test based on the RAG test.

Notes for the reviewer

  • please note that we added a new optional dependency set that needs to be installed with pip install -e .[gradient],
  • integration requires a generated access token, and tests assume set up environment variables. Please refer to our docs for SDK or for CLI. The CLI can set up environment variables with $(gradient env) command once it's configured.

Checklist

[x] I have read the contributors guidelines and the code of conduct
[x] I have updated the related issue with new insights and changes N/A
[x] I added unit tests and updated the docstrings
[x] I've used one of the conventional commit types for my PR title: fix:, feat:, build:, chore:, ci:, docs:, style:, refactor:, perf:, test:. NOTE: to be squashed.
[x] I documented my code
[x] I ran pre-commit hooks and fixed any issue

@mhlgio
mhlgio requested a review from a team as a code owner October 26, 2023 21:26
@mhlgio
mhlgio requested review from julian-risch and removed request for a team October 26, 2023 21:26
@CLAassistant

CLAassistant commented Oct 26, 2023

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@coveralls

Copy link
Copy Markdown
Collaborator

Pull Request Test Coverage Report for Build 6659953333

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.007%) to 50.839%

Files with Coverage Reduction New Missed Lines %
utils/context_matching.py 1 95.7%
Totals Coverage Status
Change from base Build 6656519629: -0.007%
Covered Lines: 13032
Relevant Lines: 25634

💛 - Coveralls

@julian-risch julian-risch left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great to see this PR! Looks quite good to me already. I was able to run the end-to-end test locally. 👍
I have some smaller change requests in the comments below. Please also generate a release note with reno as described here: https://github.com/deepset-ai/haystack/blob/main/CONTRIBUTING.md#release-notes You can put your text under preview in that note.

Comment thread haystack/preview/components/generators/gradient/base.py Outdated
Comment thread haystack/preview/components/generators/gradient/base.py Outdated
Comment thread haystack/preview/components/embedders/gradient_text_embedder.py
Comment thread haystack/preview/components/embedders/gradient_document_embedder.py
Comment thread e2e/preview/pipelines/test_gradient_rag_pipelines.py Outdated
@ZanSara
ZanSara self-requested a review October 27, 2023 12:33
@mhlgio
mhlgio requested a review from a team as a code owner October 31, 2023 18:57
@mhlgio
mhlgio requested review from dfokina and removed request for a team October 31, 2023 18:57
@mhlgio

mhlgio commented Oct 31, 2023

Copy link
Copy Markdown
Author

Great to see this PR! Looks quite good to me already. I was able to run the end-to-end test locally. 👍 I have some smaller change requests in the comments below. Please also generate a release note with reno as described here: https://github.com/deepset-ai/haystack/blob/main/CONTRIBUTING.md#release-notes You can put your text under preview in that note.

Added the release notes! let me know

@ZanSara

ZanSara commented Nov 20, 2023

Copy link
Copy Markdown
Contributor

@mhaligowski Let me try to help you with the CI:

  • The unit test failure is due to feat: upgrade canals to 0.10.1 #6309, so you need to update the serialization tests to match
  • Linting is failing because it's still missing the gradientai dependency
  • the e2e failure can be fixed by merging main into your branch, it's fixed in main.

Let me know if you need more help!

@mhlgio
mhlgio force-pushed the main branch 2 times, most recently from d924819 to b637865 Compare November 22, 2023 05:33
@ZanSara

ZanSara commented Nov 23, 2023

Copy link
Copy Markdown
Contributor

@mhaligowski here are the fixes: Preemo-Inc#12 Please merge them into your fork and let's see if they help.

One more thing: I noticed that you implemented to_dict, but not from_dict methods yet. Could you implement them? You can check the other embedders to see how it is done.

@mhlgio

mhlgio commented Nov 28, 2023

Copy link
Copy Markdown
Author

applied the fixes, trying to keep up with your main :)

@ZanSara ZanSara left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a fix

Comment on lines 5 to 13

@ZanSara ZanSara Nov 29, 2023

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The preview package is gone, here is the fix:

Suggested change
from haystack.preview import Pipeline, Document
from haystack.components.embedders.gradient_document_embedder import GradientDocumentEmbedder
from haystack.components.embedders.gradient_text_embedder import GradientTextEmbedder
from haystack.preview.document_stores import InMemoryDocumentStore
from haystack.preview.components.writers import DocumentWriter
from haystack.preview.components.retrievers import InMemoryEmbeddingRetriever
from haystack.preview.components.generators.gradient.base import GradientGenerator
from haystack.components.builders.answer_builder import AnswerBuilder
from haystack.components.builders.prompt_builder import PromptBuilder
from haystack.core import Pipeline, Document
from haystack.components.embedders.gradient_document_embedder import GradientDocumentEmbedder
from haystack.components.embedders.gradient_text_embedder import GradientTextEmbedder
from haystack.document_stores import InMemoryDocumentStore
from haystack.components.writers import DocumentWriter
from haystack.components.retrievers import InMemoryEmbeddingRetriever
from haystack.components.generators.gradient.base import GradientGenerator
from haystack.components.builders.answer_builder import AnswerBuilder
from haystack.components.builders.prompt_builder import PromptBuilder

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like the GradientGenerator wasn't moved out of the preview anyways, so I moved it. All the Gradient tests are passing now in my box!

@masci

masci commented Dec 2, 2023

Copy link
Copy Markdown
Contributor

Superseded by deepset-ai/haystack-core-integrations#72

@masci masci closed this Dec 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants